<?php
require_once 'lib/functions.jsconnect.php';

$k = Kullanicilar::model()->findByPk(Yii::app()->user->getId());

// 1. Get your client ID and secret here. These must match those in your jsConnect settings.
$clientID = "274567865";

$secret = "2b77a2567b97c2c34a30199a19566d8f";

// 2. Grab the current user from your session management system or database here.
$signedIn = !Yii::app()->user->isGuest; // this is just a placeholder

// YOUR CODE HERE.

// 3. Fill in the user information in a way that Vanilla can understand.
$user = array();

if ($signedIn) {
   // CHANGE THESE FOUR LINES.
   $user['uniqueid'] = $k->id;
   $user['name'] = $k->kullanici_adi;
   $user['email'] = $k->eposta;
   $user['photourl'] = '';
}

// 4. Generate the jsConnect string.

// This should be true unless you are testing. 
// You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla.
$secure = true; 
WriteJsConnect($user, $_GET, $clientID, $secret, $secure);
?>
